﻿/*
#**************************************************************************
#  openSIS is a student information system for public and non-public 
#  schools from Open Solutions for Education, Inc. web: www.os4ed.com
#
#  openSIS is  web-based, open source, and comes packed with features that 
#  include student demographic info, scheduling, grade book, attendance, 
#  report cards, eligibility, transcripts, parent portal, 
#  student portal and more.   
#
#  Visit the openSIS web site at http://www.opensis.com to learn more.
#  If you have question regarding this system or the license, please send 
#  an email to info@os4ed.com.
#
#  This program is released under the terms of the GNU General Public License  
#  as  published by the Free Software Foundation, version 2 of the License. 
#  See license.txt.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
#**************************************************************************** 

*/

using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using OpenSISCalenderDetailsDataLayer;

namespace OpenSISCalenderDetailsBusinessLayer
{
    /// <summary>
    /// Summary description for CalenderDetailsBL
    /// </summary>
    public class CalenderDetailsBL
    {

        private int calenderid;
        private string defaulttag;
        private string calendername;
        private string fromdate;
        private string todate;
        private string lastupdated;
        private int schoolid;
        private string sortorder;
        private int scheduleid;
        private string scheduleday;
        private string starttime;
        private string endtime;
        private string WeekEndDay;
        private string eventdate;

        public CalenderDetailsBL()
        {
            calenderid = 0;
            defaulttag = "";
            calendername = "";
            fromdate = "01/01/1900";
            todate = "01/01/1900";
            lastupdated = "01/01/1900";
            schoolid = 0;
            sortorder = "";
            scheduleid = 0;
            scheduleday = "";
            starttime = "";
            endtime = "";
            WeekEndDay = "";
            eventdate = "01/01/1900";

        }

        public int CalenderID
        {
            get
            {
                return this.calenderid;
            }
            set
            {
                this.calenderid = value;

            }
        }

        public String DefaultTag
        {
            get
            {
                return this.defaulttag;
            }
            set
            {
                this.defaulttag = value;
            }
        }

        public String CalenderName
        {
            get
            {
                return this.calendername;
            }
            set
            {
                this.calendername = value;
            }
        }

        public String FromDate
        {
            get
            {
                return this.fromdate;
            }
            set
            {
                this.fromdate = value;
            }
        }
        public String EventDate
        {
            get
            {
                return this.eventdate;
            }
            set
            {
                this.eventdate = value;
            }
        }
        public String ToDate
        {
            get
            {
                return this.todate;
            }
            set
            {
                this.todate = value;
            }
        }

        public String LastUpdated
        {
            get
            {
                return this.lastupdated;
            }
            set
            {
                this.lastupdated = value;
            }
        }

        public int SchoolID
        {
            get
            {
                return this.schoolid;
            }
            set
            {
                this.schoolid = value;

            }
        }

        public String SortOrder
        {
            get
            {
                return this.sortorder;
            }
            set
            {
                this.sortorder = value;
            }
        }

        public int ScheduleID
        {
            get
            {
                return this.scheduleid;
            }
            set
            {
                this.scheduleid = value;

            }
        }

        public String ScheduleDay
        {
            get
            {
                return this.scheduleday;
            }
            set
            {
                this.scheduleday = value;
            }
        }

        public String StartTime
        {
            get
            {
                return this.starttime;
            }
            set
            {
                this.starttime = value;
            }
        }

        public String EndTime
        {
            get
            {
                return this.endtime;
            }
            set
            {
                this.endtime = value;
            }
        }

        public String CalWeekEndDay
        {
            get
            {
                return this.WeekEndDay;
            }
            set
            {
                this.WeekEndDay = value;
            }
        }

        public int AddCalenderDetails()
        {
            CalenderDetailsDL CDDL = new CalenderDetailsDL();

            calenderid = CDDL.AddCalenderDetails(this);

            return calenderid;
        }

        public void UpdateCalenderDetails()
        {
            CalenderDetailsDL CDDL = new CalenderDetailsDL();
            CDDL.UpdateCalenderDetails(this);
        }

        public System.Data.DataTable PopulateCalenderDetails()
        {
            DataTable dt = null;
            CalenderDetailsDL CDDL = new CalenderDetailsDL();

            dt = CDDL.PopulateCalenderDetails(this);
            return dt;


        }

        public void UpdateShortOrder()
        {
            CalenderDetailsDL CDDL = new CalenderDetailsDL();
            CDDL.UpdateCalenderDetailsShortOrder(this);
        }

        public void DeleteCalDetails()
        {
            CalenderDetailsDL CDDL = new CalenderDetailsDL();
            CDDL.DeleteCalDetails(this);
        }

        public void AddCalDaySchedule()
        {
            CalenderDetailsDL CDDL = new CalenderDetailsDL();
            CDDL.AddCalDaySchedule(this);
        }

        public void DeleteCalDaySchedule()
        {
            CalenderDetailsDL CDDL = new CalenderDetailsDL();
            CDDL.DeleteCalDaySchedule(this);
        }

        public System.Data.DataTable PopulateCalenderDaySchedule()
        {
            DataTable dt = null;
            CalenderDetailsDL CDDL = new CalenderDetailsDL();

            dt = CDDL.PopulateCalenderDaySchedule(this);
            return dt;


        }

        public void PopulatecalendarDropdown(ref System.Web.UI.WebControls.DropDownList ddl)
        {

            string s = System.Web.HttpContext.Current.Session["MLCulture"].ToString();

            string select = "";

            switch (s)
            {
                case "en-US":
                    select = "Select";

                    break;
                case "es-MX":
                    select = "Seleccione";

                    break;
                case "zh-CN":
                    select = "选择";

                    break;
                case "ja-JP":
                    select = "を選択";

                    break;
                case "de-DE":
                    select = "Wählen Sie";

                    break;
                case "ko-KR":
                    select = "선택";

                    break;
                case "fr-FR":
                    select = "Sélectionnez";

                    break;
                case "it-IT":
                    select = "Seleziona";

                    break;
                case "ru-RU":
                    select = "Выберите";

                    break;
                case "pt-BR":
                    select = "Seleccione";

                    break;
                case "ar-SA":
                    select = "رتخا";

                    break;
            }


            CalenderDetailsDL CDDL = new CalenderDetailsDL();
            ddl.Items.Clear();
            DataTable dt = null;
            dt = CDDL.PopulateCalenderDetails(this);
            ddl.DataSource = dt;
            ddl.DataTextField = "Calender_Name";
            ddl.DataValueField = "Caleder_Id";
            ddl.DataBind();
            ddl.Items.Insert(0, new ListItem(select, "0"));


        }


        public System.Data.DataTable PopulateCalenderWeekEndDaySchedule()
        {
            DataTable dt = null;
            CalenderDetailsDL CDDL = new CalenderDetailsDL();

            dt = CDDL.PopulateCalenderWeekEndDaySchedule(this);
            return dt;


        }

        public System.Data.DataTable CheckWeekEndDay()
        {
            DataTable dt = null;
            CalenderDetailsDL CDDL = new CalenderDetailsDL();

            dt = CDDL.CheckCalenderWeekEndDay(this);
            return dt;


        }

        //***************30/07/09*************************
        public void AddCalWeekEndDaySchedule()
        {
            CalenderDetailsDL CDDL = new CalenderDetailsDL();
            CDDL.AddCalWeekEndDaySchedule(this);
        }

        public void DeleteCalWeekEndDaySchedule()
        {
            CalenderDetailsDL CDDL = new CalenderDetailsDL();
            CDDL.DeleteCalWeekEndDaySchedule(this);
        }


        //Added on 19th august*************************************

        public System.Data.DataTable CheckHoliday()
        {
            DataTable dt = null;
            CalenderDetailsDL CDDL = new CalenderDetailsDL();

            dt = CDDL.CheckHoliday(this);
            return dt;


        }


        public System.Data.DataTable CheckSchoolDay()
        {
            DataTable dt = null;
            CalenderDetailsDL CDDL = new CalenderDetailsDL();

            dt = CDDL.CheckSchoolDay(this);
            return dt;


        }

        //*********************************Added on 4th sept 2009***********************//

        public System.Data.DataTable CheckHolidayforschlevent()
        {
            DataTable dt = null;
            CalenderDetailsDL CDDL = new CalenderDetailsDL();

            dt = CDDL.CheckHolidayforschlevent(this);
            return dt;


        }


        public System.Data.DataTable Checkschlwrtweekend()
        {
            DataTable dt = null;
            CalenderDetailsDL CDDL = new CalenderDetailsDL();

            dt = CDDL.Checkschlwrtweekend(this);
            return dt;


        }

        //*****26/04/2010*******

        public System.Data.DataTable ExistCallenderDetailsSchedule()
        {
            DataTable dt = null;
            CalenderDetailsDL CDDL = new CalenderDetailsDL();
            dt = CDDL.ExistCallenderDetailsSchedule(this);
            return dt;
        }

    }
}